#ifndef ADDDIALOG_H
#define ADDDIALOG_H


#include "ui_adddialog.h"
#include <QDialog>
#include <QAbstractButton>
#include <QStandardItemModel>
#include "student.h"

namespace Ui {
class addDialog;
}

class AddDialog : public QDialog
{
    Q_OBJECT

public:
    explicit AddDialog(QWidget *parent = nullptr);
    ~AddDialog();

    void initData();
    void setModel(QStandardItemModel *model);

    Student getStu() const;
    void setStu(const Student &value);

private slots:
    void on_buttonBox_clicked(QAbstractButton *button);

private:
    Ui::addDialog *ui;
    QStandardItemModel *model;
    Student stu;

    void stu2ui();
    void ui2stu();
    void appendItem();

};

#endif // ADDDIALOG_H
